const { Stack } = require('./01.栈结构')
function dec2bin(decNumber) {
  const s1 = new Stack()
  while (decNumber > 0) {
    // 1.将余数压入栈中
    s1.push(decNumber % 2)
    decNumber = Math.floor(decNumber / 2)
  }
  let binStr = ''
  while (!s1.isEmpty()) {
    binStr += s1.pop()
  }
  return binStr
}
console.log(dec2bin(3))
